PURL parsing, manipulation, and formatting.
A PURL is an identifier that refers to a software package. For example,
pkg:cargo/purl
refers to this package.
This library supports PURLs at two levels:
- The shape and format of a PURL is implemented by
GenericPurl
. It is possible to work with package-type-agnostic PURLs by using types likeGenericPurl<String>
. (see also package-url/purl-spec#38) - The behavior of package types is implemented by
PackageType
and combined withGenericPurl
by the type aliasPurl
. This implementation differs slightly from the PURL specification (seePackageType
for details). It is possible to implement different package-type-specific behaviors or support for different package types by implementing thePurlShape
trait.
Example
use FromStr;
use GenericPurl;
Features
- package-type:
PackageType
and related types - serde: PURLs can be serialized and deserialized from strings
- smartstring: The smartstring crate is used to reduce heap allocations